package book;

/**
 * 书
 */

public class Book {
    private String name;//书名
    private String author;//作者
    private int price;//价格
    private String type;//书的类别
    private Boolean isBorrowed;//是否借出

    //由于私有的在类外不可以访问，所以添加getter setter
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Boolean getIsBorrowed() {
        return isBorrowed;
    }

    public void setIsBorrowed(Boolean isBorrowed) {
        this.isBorrowed = isBorrowed;
    }

    //提供构造方法 isBorrowed默认就是false所以不用给他提供

    public Book(String name, String author, int price, String type,Boolean isBorrowed) {
        this.name = name;
        this.author = author;
        this.price = price;
        this.type = type;
        this.isBorrowed = isBorrowed;
    }

    //toString方法

    @Override
    public String toString() {
        return "Book{" +
                "name='" + name + '\'' +
                ", author='" + author + '\'' +
                ", price=" + price +
                ", type='" + type + '\'' +", 借阅状态= " +
                (isBorrowed?"'已经借出'":"'未借出'")
                +'}';
    }
}





